package com.zhuannimei.utility;

import android.text.TextUtils;

/**
 * 用户信息
 * 
 * @author xxhong
 * 
 */
public class UserData {
	public static final String USER_NAME = "user_name";
	public static final String USER_PASSWORD = "user_password";
	public static final String USER_ID = "user_id";
	public static final String USER_POINT = "user_point";
	public static final String IS_COMMNENDER = "is_commender";
	

	private UserData() {
	}

	private static UserData userData = new UserData();

	public static UserData getInstance() {
		return userData;
	}

	/**
	 * 获取用户名
	 * 
	 * @return
	 */
	public String getUserName() {
		return PersistTool.getString(USER_NAME, "");
	}

	/**
	 * 保存用户名
	 * 
	 * @param userName
	 * @return
	 */
	public boolean saveUserName(String userName) {
		return PersistTool.saveString(USER_NAME, userName);
	}
	/**
	 * 获取密码
	 * 
	 * @return
	 */
	public String getUserPassword() {
		return PersistTool.getString(USER_PASSWORD, "");
	}

	/**
	 * 保存密码
	 * 
	 * @param userName
	 * @return
	 */
	public boolean saveUserPassword(String userName) {
		return PersistTool.saveString(USER_PASSWORD, userName);
	}

	/**
	 * 获取用户id
	 * 
	 * @return
	 */
	public String getUserUserId() {
		return PersistTool.getString(USER_ID, "");
	}

	/**
	 * 保存用户id
	 * 
	 * @param userName
	 * @return
	 */
	public boolean saveUserUserId(String userId) {
		return PersistTool.saveString(USER_ID, userId);
	}

	/**
	 * 获取用户积分
	 * 
	 * @return
	 */
	public String getUserPoint() {
		return PersistTool.getString(USER_POINT, "");
	}

	/**
	 * 保存用户积分
	 * 
	 * @param userName
	 * @return
	 */
	public boolean saveUserPoint(String userId) {
		return PersistTool.saveString(USER_POINT, userId);
	}
	/**
	 * 
	 * @param flag 1为推广员  
	 * @return
	 */
	public boolean isCommender(String flag){
		return PersistTool.saveString(IS_COMMNENDER, flag);
	}
	public String getISCommender(){
		return PersistTool.getString(IS_COMMNENDER, "");
	}
	public boolean clear(){
		return PersistTool.clearAll();
	}

}	
